<template>
  <div class="containers">
    <div class="container">
      <div class="form-box" style="width: 100%;max-width: 900px;">
        <el-tabs >
          <el-tab-pane label="利润分配设置" >
            <el-form ref="form" label-width="120px">
              <el-form-item label="税收">
                <el-input v-model="form.taxation"></el-input>
              </el-form-item>
              <el-form-item label="公益基金">
                <el-input v-model="form.fund"></el-input>
              </el-form-item>
              <el-form-item label="平台管理费">
                <el-input v-model="form.manage"></el-input>
              </el-form-item>
              <el-form-item label="加权分红">
                <el-input v-model="form.bonus"></el-input>
              </el-form-item>
              <el-form-item label="加速分红">
                <el-input v-model="form.accelerate"></el-input>
              </el-form-item>
              <el-form-item label="贡献值凭证拉伸">
                <el-input v-model="form.prove"></el-input>
              </el-form-item>

              <span class="dialog-footer">
                <el-button type="prove" @click="setlv()">确 定</el-button>
              </span>
            </el-form>
          </el-tab-pane>
          <el-tab-pane label="利润设置" >
            <el-form ref="updata" label-width="200px">
              <el-form-item label="税收">
                <el-input v-model="updata.taxation" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="公益基金">
                <el-input v-model="updata.fund" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="平台管理费">
                <el-input v-model="updata.manage" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="加速分红">
                <el-input v-model="updata.accelerate" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="今日加速分红金额">
                <el-input v-model="updata.today_accelerate"></el-input>
              </el-form-item>
              <el-form-item label="贡献值凭证拉伸">
                <el-input v-model="updata.prove" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="今日贡献值凭证拉伸">
                <el-input v-model="updata.today_prove"></el-input>
              </el-form-item>
              <el-form-item label=" 当日需要分的加权分红利润">
                <el-input v-model="updata.today_bonus"></el-input>
              </el-form-item>
              <el-form-item label=" 当日加权分红利润">
                <el-input v-model="updata.bonus" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label=" 总分红账户">
                <el-input v-model="updata.total_bonus" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label=" 总利润账户的茶花">
                <el-input v-model="updata.total_money" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label=" 总利润账户的贡献值凭证">
                <el-input v-model="updata.total_prove" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label=" 总加速沉淀的金额">
                <el-input v-model="updata.total_accelerate_money" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label=" 总拉伸沉淀的金额">
                <el-input v-model="updata.total_prove_money" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label=" 贡献值凭证价值">
                <el-input v-model="updata.price"></el-input>
              </el-form-item>
              <el-form-item label=" 释放凭证比例">
                <el-input v-model="updata.release"></el-input>
              </el-form-item>
              <el-form-item label=" 最高涨幅">
                <el-input v-model="updata.max_increase"></el-input>
              </el-form-item>
              <el-form-item label=" 最低涨幅">
                <el-input v-model="updata.min_increase"></el-input>
              </el-form-item>
              <span class="dialog-footer">
                <el-button type="prove" @click="setlvs()">确 定</el-button>
              </span>
            </el-form>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>

<script>

export default {


  data() {
    return {
      code:0,
      form: {
        accelerate: 0,
        bonus: 0,
        fund: 0,
        manage: 0,
        prove: 0,
        taxation: 0,
      },
      updata:{
        today_accelerate:0,
        today_prove:0,
        today_bonus:0,
        accelerate: 0,
        bonus: 0,
        fund: 6.86,
        manage: 44.1,
        price: 2.738095238095238,
        total_accelerate_money:0,
        total_prove_money:0,
        prove: 0,
        taxation: 32.34,
        total_bonus: 0,
        total_money: 112.7,
        total_prove: 41.160000000000004,
        release:0,
        max_increase:0,
        min_increase:0

      }

    };
  },
  created() {
    this.load()//获取
  },
  methods: {
    load() {
      this.request('admin/allocation/', 'get', {}).then(
        res => {
          if (res.errno == 0) {
            this.form = res.data
          }
        },
        function () {
          console.log('请求失败处理');
        }
      );
      this.request('admin/capital/', 'get', {}).then(
        res => {
          if (res.errno == 0) {
            this.updata = res.data
            console.log( res.data)
          }
        },
        function () {
          console.log('请求失败处理');
        }
      );
    },
    setlvs() {
      this.request('admin/capital/', 'post', {
        today_accelerate:Number(this.updata.today_accelerate),
        today_prove:Number(this.updata.today_prove),
        today_bonus:Number(this.updata.today_bonus),
        price:Number(this.updata.price),
        release:Number(this.updata.release),
        max_increase:Number(this.updata.max_increase),
        min_increase:Number(this.updata.min_increase)
      }).then(
        res => {
          this.$message.success(res.errmsg)
        },
        function () {
          console.log('请求失败处理');
        }
      );
    },
    setlv() {
      this.form.accelerate = Number(this.form.accelerate)
      this.form.bonus = Number(this.form.bonus)
      this.form.fund = Number(this.form.fund)
      this.form.manage = Number(this.form.manage)
      this.form.prove = Number(this.form.prove)
      this.form.taxation = Number(this.form.taxation)
      this.request('admin/allocation/', 'post', this.form).then(
        res => {
          this.$message.success(res.errmsg)
        },
        function () {
          console.log('请求失败处理');
        }
      );
    },




  }
};
</script>
<style scoped="scoped">
.container {
  padding: 20px;
}

.activeattr {
  border: 1px solid rgb(64, 158, 255);
  color: rgb(64, 158, 255);
}

.el-upload {
  width: 100px !important;
  height: 100px !important;
}
</style>
